package com.qf.hospital.controller;

import com.qf.hospital.service.DoctorService;
import com.qf.hospital.service.RegisterService;
import com.qf.hospital.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author 何星宇
 * @version V1.0
 * @Date 2021/10/19 20:16
 */

@RestController
public class MainController {
    @Autowired
    private DoctorService doctorService;
    @Autowired
    private RegisterService registerService;
    @Autowired
    private ReportService reportService;

    /**
     * 根据星期查找排班信息
     * @param week
     * @return
     */
    @PostMapping("/main/paiban/{week}")
    public List<Map<String,String>> paiban(@PathVariable String week){
        List<Map<String,String>> result = doctorService.findSchedulerByWeek(week);
        return result;
    }

    /**
     * 查询住院总人数
     * @return
     */
    @PostMapping("/main/zhuyuanTotal")
    public Integer registerTotal(){
        Integer count = registerService.findRegisterTotal();
        return count;
    }

    /**
     * 查询今日住院总人数
     * @return
     */
    @PostMapping("/main/currentZhuYuan")
    public Integer registerCurrent(){
        Integer count = registerService.findRegisterCurrent();
        return count;
    }

    /**
     * 查询就诊总人数
     * @return
     */
    @PostMapping("/main/Total")
    public Integer reportTotal(){
        Integer count = reportService.findReportTotal();
        return count;
    }

    /**
     * 查询今日住院总人数
     * @return
     */
    @PostMapping("/main/currentNum")
    public Integer reportCurrent(){
        Integer count = reportService.findReportCurrent();
        return count;
    }
}
